#include "Food.h"
#include <iostream>

Food::Food(Container *parent, int x, int y, int size, FoodType type)
    : x(x), y(y), size(size), type(type)
{

    foodContainer = std::make_unique<Container>(parent, size, size, x, y);
    foodContainer->set_Visible(true);
    renderFood();
}

void Food::setType(FoodType newType)
{
    type = newType;
    renderFood();
}

void Food::renderFood()
{
    const char *imagePath = "";

    switch (type)
    {
    case FOOD_NORMAL:
        imagePath = "./res/food_normal.bmp";
        break;
    case FOOD_BUFF:
        imagePath = "./res/food_buff.bmp";
        break;
    case FOOD_DEBUFF:
        imagePath = "./res/food_debuff.bmp";
        break;
    case FOOD_PEPPER: // 新添加
        imagePath = "./res/food_pepper.bmp";
        break;
    case FOOD_ICE_CREAM: // 新添加
        imagePath = "./res/food_ice_cream.bmp";
        break;
    case Donut: // 新添加
        imagePath = "./res/Donut.bmp";
        break;
    case Cake: // 新添加
        imagePath = "./res/Cake.bmp";
        break;
    case Milk: // 新添加
        imagePath = "./res/Milk.bmp";
        break;
    case Candied_hawthorn: // 新添加
        imagePath = "./res/Candied_hawthorn.bmp";
        break;
    }

    foodContainer->set_background_image(imagePath, true, 0x00FFFFFF);
}